/* 📱 精英杂志移动端优化样式 */

/* 🔧 基础响应式设置 */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
    overflow-x: hidden;
}

/* 📐 容器响应式布局 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* 🧭 导航栏移动端优化 */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #1e3a8f, #3b82f6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: white !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}

.nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white !important;
}

/* 📖 主内容区域优化 */
main.container {
    padding: 1rem 0;
    min-height: calc(100vh - 120px);
}

/* 📝 文章卡片样式 */
.article-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.article-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.article-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e3a8f;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.article-content {
    padding: 1.5rem;
    font-size: 1rem;
    line-height: 1.7;
    color: #374151;
}

.article-content p {
    margin: 0 0 1rem 0;
}

/* 📱 平板设备适配 (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 0 20px;
    }
    
    .navbar {
        padding: 0.75rem 0;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .article-title {
        font-size: 1.3rem;
    }
    
    .article-content {
        font-size: 0.95rem;
    }
}

/* 📱 移动设备适配 (max-width: 768px) */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    .container {
        padding: 0 15px;
    }
    
    /* 导航栏移动端优化 */
    .navbar {
        padding: 0.5rem 0;
        position: fixed;
        width: 100%;
        top: 0;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-nav {
        gap: 0.5rem;
    }
    
    .nav-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.875rem;
    }
    
    /* 主内容区域调整 */
    main.container {
        padding: 4rem 0 1rem 0;
        margin-top: 0;
    }
    
    /* 文章卡片移动端优化 */
    .article-card {
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    .article-header {
        padding: 1rem;
    }
    
    .article-title {
        font-size: 1.1rem;
        margin-bottom: 0.4rem;
    }
    
    .article-meta {
        font-size: 0.8rem;
        gap: 0.5rem;
    }
    
    .article-content {
        padding: 1rem;
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    /* 触摸优化 */
    .article-card,
    .nav-link,
    .pwa-button {
        -webkit-tap-highlight-color: rgba(30, 58, 143, 0.1);
    }
}

/* 📱 小屏移动设备 (max-width: 480px) */
@media (max-width: 480px) {
    html {
        font-size: 13px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .navbar-brand {
        font-size: 0.9rem;
    }
    
    .nav-link {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .article-title {
        font-size: 1rem;
    }
    
    .article-content {
        font-size: 0.85rem;
        padding: 0.8rem;
    }
    
    .article-header {
        padding: 0.8rem;
    }
}

/* 🌙 深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #0f172a;
        color: #e2e8f0;
    }
    
    .navbar {
        background: linear-gradient(135deg, #0f172a, #1e293b);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .article-card {
        background: #1e293b;
        border: 1px solid rgba(255, 255, 255, 0.05);
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    }
    
    .article-header {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .article-title {
        color: #60a5fa;
    }
    
    .article-content {
        color: #cbd5e1;
    }
    
    .article-meta {
        color: #94a3b8;
    }
}

/* 🍎 iOS Safari 特殊优化 */
@supports (-webkit-touch-callout: none) {
    .navbar {
        padding-top: calc(0.5rem + env(safe-area-inset-top));
    }
    
    main.container {
        padding-top: calc(4rem + env(safe-area-inset-top));
    }
    
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* 🎯 PWA 独立模式优化 */
@media (display-mode: standalone) {
    .navbar {
        padding-top: calc(0.5rem + env(safe-area-inset-top));
    }
    
    main.container {
        padding-top: calc(4rem + env(safe-area-inset-top));
    }
    
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ⚡ 性能优化 */
.article-card,
.navbar,
.pwa-button {
    will-change: transform;
    transform: translateZ(0);
}

/* 🎯 触摸目标优化 */
.nav-link,
.pwa-button,
#pwa-install-button {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 🔄 加载状态 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: #6b7280;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(30, 58, 143, 0.1);
    border-top-color: #1e3a8f;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 🎨 辅助样式 */
.text-center { text-align: center; }
.text-muted { color: #6b7280; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }

/* 📰 文章网格布局 */
.articles-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* 📝 文章卡片增强样式 */
.article-card .article-title a {
    color: inherit;
    transition: color 0.3s ease;
}

.article-card .article-title a:hover {
    color: #3b82f6;
}

/* 🏷️ 标签样式 */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* 🌙 深色模式下的标签 */
@media (prefers-color-scheme: dark) {
    .tag {
        background: rgba(96, 165, 250, 0.1);
        color: #60a5fa;
        border-color: rgba(96, 165, 250, 0.2);
    }
    
    .article-card .article-title a:hover {
        color: #60a5fa;
    }
}

/* 📱 响应式网格 */
@media (max-width: 768px) {
    .articles-grid {
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .articles-grid {
        gap: 1rem;
    }
    
    .article-tags {
        gap: 0.25rem;
    }
    
    .tag {
        font-size: 0.7rem;
        padding: 0.2rem 0.6rem;
    }
}

/* 🎯 显示工具类 */
.display-4 {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.fw-bold {
    font-weight: 700;
}

.text-decoration-none {
    text-decoration: none;
}

/* 🌈 渐变背景 */
.bg-gradient {
    background: linear-gradient(135deg, #1e3a8f, #3b82f6);
}

/* 📐 弹性布局工具 */
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }

/* 🔧 工具类 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}